/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package protocolHandler;

import java.util.Scanner;

/**
 *
 * @author Александр Емельянов (mr.lex91@gmail.com)
 */
public class ProtoMessageParser extends ProtoHandler{
    public void Parse(String msg)
    {
        Scanner sc=new Scanner(msg);
        setType(sc.nextLine());
        while (sc.hasNext())
        {
            String header=sc.next();
            header=header.substring(0, header.length()-1);
            String body=sc.nextLine();
            body=body.substring(1,body.length());
            if ("Text".equalsIgnoreCase(header) || "Folowers".equalsIgnoreCase(header)) while (sc.hasNextLine()) body+="\n"+sc.nextLine();
            addHeader(header, body);
        }
    }
}
